package net.zoneland.knowledge.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.google.common.collect.Lists;

import net.zoneland.knowledge.constant.SystemConstant;
import net.zoneland.knowledge.enums.QueryTypeEnum;
import net.zoneland.knowledge.enums.VisitTypeEnum;

/**
 * .
 *
 * @author: bcc
 * 2021/5/25
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class QaQueryDto implements Serializable {

    private static final long serialVersionUID = 1L;

    private String id;

    private List<String> categoryList;

    private String queryText;

    private QueryTypeEnum qaType;

    private String level1Title;

    private String level2Title;

    private String level3Title;

    private boolean showAll;

    private String category;

    private String flag;

    private List<String> orgDeptDnList;

    /**
     * 机器人名称.
     */
    private String robotName;

    private List<String> flags;

    private String talkSessionId;

    private LoginUserPojo loginUserPojo;

    private List<String> userIds = new ArrayList<>();

    private List<String> deptIds = new ArrayList<>();

    private List<String> roleFlags = new ArrayList<>();

    private VisitTypeEnum visitType;

    /**
     * 点击查询.
     * <p>
     *  0：输入查询；1：点击查询；
     * </p>
     */
    private int clickSearch;
    /**
     * 用于标识我的足迹的一级栏目.
     */
    private String queryLevel1Title;

    /**
     * 标记切换栏目.
     * 切换栏目时不保留足迹
     */
    private boolean switchCategory;

    /**
     * showAll时是否显示二级科目.
     */
    private boolean fetchLevel2;

    /**
     * 分词结果.
     */
    private List<String> wordTokens;

    /**
     * .
     *
     * @return clickSearch
     */
    public String getQueryLevel1Title() {
        return queryLevel1Title;
    }
    /**
     * .
     * @param queryLevel1Title 用于标识我的足迹的一级栏目
     */
    public void setQueryLevel1Title(final String queryLevel1Title) {
        this.queryLevel1Title = queryLevel1Title;
    }

    /**
     * .
     *
     * @return clickSearch
     */
    public int getClickSearch() {
        return clickSearch;
    }
    /**
     * .
     * @param clickSearch 点击查询
     */
    public void setClickSearch(final int clickSearch) {
        this.clickSearch = clickSearch;
    }
    /**
     * .
     * @return 访问类型
     */
    public VisitTypeEnum getVisitType() {
        return visitType;
    }

    /**
     * .
     * @param visitType 访问类型
     */
    public void setVisitType(final VisitTypeEnum visitType) {
        this.visitType = visitType;
    }

    /**
     * .
     *
     * @return id
     */
    public String getId() {
        return id;
    }

    /**
     * .
     *
     * @param id to set
     */
    public void setId(final String id) {
        this.id = id;
    }

    /**
     * .
     *
     * @return categoryList
     */
    public List<String> getCategoryList() {
        return Optional.ofNullable(categoryList).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param categoryList to set
     */
    public void setCategoryList(final List<String> categoryList) {
        this.categoryList = Optional.ofNullable(categoryList).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return queryText
     */
    public String getQueryText() {
        return queryText;
    }

    /**
     * .
     *
     * @param queryText to set
     */
    public void setQueryText(final String queryText) {
        this.queryText = queryText;
    }

    /**
     * .
     *
     * @return qaType
     */
    public QueryTypeEnum getQaType() {
        return qaType;
    }

    /**
     * .
     *
     * @param qaType to set
     */
    public void setQaType(final QueryTypeEnum qaType) {
        this.qaType = qaType;
    }

    /**
     * .
     *
     * @return level1Title
     */
    public String getLevel1Title() {
        return level1Title;
    }

    /**
     * .
     *
     * @param level1Title to set
     */
    public void setLevel1Title(final String level1Title) {
        this.level1Title = level1Title;
    }

    /**
     * .
     *
     * @return level2Title
     */
    public String getLevel2Title() {
        return level2Title;
    }

    /**
     * .
     *
     * @param level2Title to set
     */
    public void setLevel2Title(final String level2Title) {
        this.level2Title = level2Title;
    }

    /**
     * .
     *
     * @return level3Title
     */
    public String getLevel3Title() {
        return level3Title;
    }

    /**
     * .
     *
     * @param level3Title to set
     */
    public void setLevel3Title(final String level3Title) {
        this.level3Title = level3Title;
    }

    /**
     * .
     *
     * @return showAll
     */
    public boolean isShowAll() {
        return showAll;
    }

    /**
     * .
     *
     * @param showAll to set
     */
    public void setShowAll(final boolean showAll) {
        this.showAll = showAll;
    }

    /**
     * .
     *
     * @return category
     */
    public String getCategory() {
        return category;
    }

    /**
     * .
     *
     * @param category to set
     */
    public void setCategory(final String category) {
        this.category = category;
    }

    /**
     * .
     *
     * @return flag
     */
    public String getFlag() {
        return flag;
    }

    /**
     * .
     *
     * @param flag to set
     */
    public void setFlag(final String flag) {
        this.flag = flag;
    }

    /**
     * .
     *
     * @return orgDeptDnList
     */
    public List<String> getOrgDeptDnList() {
        return Optional.ofNullable(orgDeptDnList).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param orgDeptDnList to set
     */
    public void setOrgDeptDnList(final List<String> orgDeptDnList) {
        this.orgDeptDnList = Optional.ofNullable(orgDeptDnList).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return robotName
     */
    public String getRobotName() {
        return robotName;
    }

    /**
     * .
     *
     * @param robotName to set
     */
    public void setRobotName(final String robotName) {
        this.robotName = robotName;
    }

    /**
     * .
     *
     * @return flags
     */
    public List<String> getFlags() {
        if (null == flags) {
            flags = new ArrayList<>();
            flags.add(SystemConstant.COMMON_VIEW_FLAG);
            flags.add(flag.trim());
        }
        return Optional.ofNullable(flags).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param flags to set
     */
    public void setFlags(final List<String> flags) {
        this.flags = Optional.ofNullable(flags).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }


    /**
     * .
     *
     * @return talkSessionId
     */
    public String getTalkSessionId() {
        return talkSessionId;
    }

    /**
     * .
     *
     * @param talkSessionId to set
     */
    public void setTalkSessionId(final String talkSessionId) {
        this.talkSessionId = talkSessionId;
    }


    /**
     * .
     *
     * @return loginUserPojo
     */
    public LoginUserPojo getLoginUserPojo() {
        return loginUserPojo;
    }

    /**
     * .
     *
     * @param loginUserPojo to set
     */
    public void setLoginUserPojo(final LoginUserPojo loginUserPojo) {
        this.loginUserPojo = loginUserPojo;
    }

    /**
     * .
     *
     * @return userIds
     */
    public List<String> getUserIds() {
        return Optional.ofNullable(userIds).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param userIds to set
     */
    public void setUserIds(final List<String> userIds) {
        this.userIds = Optional.ofNullable(userIds).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return deptIds
     */
    public List<String> getDeptIds() {
        return Optional.ofNullable(deptIds).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param deptIds to set
     */
    public void setDeptIds(final List<String> deptIds) {
        this.deptIds = Optional.ofNullable(deptIds).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return roleFlags
     */
    public List<String> getRoleFlags() {
        return Optional.ofNullable(roleFlags).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param roleFlags to set
     */
    public void setRoleFlags(final List<String> roleFlags) {
        this.roleFlags = Optional.ofNullable(roleFlags).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return switchCategory
     */
    public boolean isSwitchCategory() {

        return switchCategory;
    }

    /**
     * .
     *
     * @param switchCategory to set
     */
    public void setSwitchCategory(final boolean switchCategory) {

        this.switchCategory = switchCategory;
    }

    /**
     * .
     *
     * @return fetchLevel2
     */
    public boolean isFetchLevel2() {

        return fetchLevel2;
    }

    /**
     * .
     *
     * @param fetchLevel2 to set
     */
    public void setFetchLevel2(final boolean fetchLevel2) {

        this.fetchLevel2 = fetchLevel2;
    }


    /**
     * .
     *
     * @return wordTokens
     */
    public List<String> getWordTokens() {

        return wordTokens;
    }

    /**
     * .
     *
     * @param wordTokens to set
     */
    public void setWordTokens(final List<String> wordTokens) {

        this.wordTokens = wordTokens;
    }

    @Override
    public String toString() {

        final StringBuilder sb = new StringBuilder("QaQueryDto{");
        sb.append("id='")
            .append(id)
            .append('\'');
        sb.append(", categoryList=")
            .append(categoryList);
        sb.append(", queryText='")
            .append(queryText)
            .append('\'');
        sb.append(", qaType=")
            .append(qaType);
        sb.append(", level1Title='")
            .append(level1Title)
            .append('\'');
        sb.append(", level2Title='")
            .append(level2Title)
            .append('\'');
        sb.append(", level3Title='")
            .append(level3Title)
            .append('\'');
        sb.append(", showAll=")
            .append(showAll);
        sb.append(", category='")
            .append(category)
            .append('\'');
        sb.append(", flag='")
            .append(flag)
            .append('\'');
        sb.append(", orgDeptDnList=")
            .append(orgDeptDnList);
        sb.append(", robotName='")
            .append(robotName)
            .append('\'');
        sb.append(", flags=")
            .append(flags);
        sb.append(", talkSessionId='")
            .append(talkSessionId)
            .append('\'');
        sb.append(", loginUserPojo=")
            .append(loginUserPojo);
        sb.append(", userIds=")
            .append(userIds);
        sb.append(", deptIds=")
            .append(deptIds);
        sb.append(", roleFlags=")
            .append(roleFlags);
        sb.append(", visitType=")
            .append(visitType);
        sb.append(", clickSearch=")
            .append(clickSearch);
        sb.append(", queryLevel1Title='")
            .append(queryLevel1Title)
            .append('\'');
        sb.append(", switchCategory=")
            .append(switchCategory);
        sb.append(", fetchLevel2=")
            .append(fetchLevel2);
        sb.append(", wordTokens=")
            .append(wordTokens);
        sb.append('}');
        return sb.toString();
    }

}
